home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / CW GUSI 1.6.4 / include / sys⁄types.h < prev    next >
Text File  |  1995-06-05  |  5KB  |  173 lines

  1. /*-
  2.  * Copyright (c) 1982, 1986, 1991 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)types.h    7.17 (Berkeley) 5/6/91
  34.  */
  35.  
  36. #ifndef _TYPES_H_
  37. #define    _TYPES_H_
  38.  
  39. #ifdef __MWERKS__
  40. #ifndef macintosh
  41. #define macintosh 1
  42. #endif
  43. /*
  44.  * Metrowerks C++ 1.2.2 sometimes seems to be confused about search path order.
  45.  * Furthermore, users sometimes make mistakes, too.
  46.  */
  47. #ifdef _FCNTL
  48. #ifndef _FCNTL_H_
  49. #error "Headers conflict. Please #include <sys/types.h> before <fcntl.h>"
  50. #endif
  51. #else
  52. /* Prevent future inclusions of MW fcntl.h */
  53. #define _FCNTL
  54. #endif
  55. #endif
  56.  
  57. typedef    unsigned char    u_char;
  58. typedef    unsigned short    u_short;
  59. typedef    unsigned int    u_int;
  60. typedef    unsigned long    u_long;
  61. typedef    unsigned short    ushort;        /* Sys V compatibility */
  62.  
  63. typedef    char *    caddr_t;        /* core address */
  64. typedef    long    daddr_t;        /* disk address */
  65. typedef    short    dev_t;            /* device number */
  66. typedef    u_long    ino_t;            /* inode number */
  67. typedef    long    off_t;            /* file offset (should be a quad) */
  68. typedef    u_short    nlink_t;        /* link count */
  69. typedef    long    swblk_t;        /* swap offset */
  70. typedef    long    segsz_t;        /* segment size */
  71. typedef    u_short    uid_t;            /* user id */
  72. typedef    u_short    gid_t;            /* group id */
  73. typedef    short    pid_t;            /* process id */
  74. typedef    u_short    mode_t;            /* permissions */
  75. typedef u_long    fixpt_t;        /* fixed point number */
  76.  
  77. #ifndef _POSIX_SOURCE
  78. typedef    struct    _uquad    { u_long val[2]; } u_quad;
  79. typedef    struct    _quad    {   long val[2]; } quad;
  80. typedef    long *    qaddr_t;    /* should be typedef quad * qaddr_t; */
  81.  
  82. #ifndef macintosh
  83. #define    major(x)    ((int)(((u_int)(x) >> 8)&0xff))    /* major number */
  84. #define    minor(x)    ((int)((x)&0xff))        /* minor number */
  85. #define    makedev(x,y)    ((dev_t)(((x)<<8) | (y)))    /* create dev_t */
  86. #endif
  87. #endif
  88.  
  89. #include <machine/ansi.h>
  90. #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  91. #include <machine/types.h>
  92. #endif
  93.  
  94. #ifdef    _CLOCK_T_
  95. #ifdef macintosh
  96. #include <Time.h>
  97. #undef _TIME_T_
  98. #else
  99. typedef    _CLOCK_T_    clock_t;
  100. #endif
  101. #undef    _CLOCK_T_
  102. #endif
  103.  
  104. #ifdef    _SIZE_T_
  105. #ifdef macintosh
  106. #include <StdLib.h>
  107. #else
  108. typedef    _SIZE_T_    size_t;
  109. #endif
  110. #undef    _SIZE_T_
  111. #endif
  112.  
  113. #ifdef    _TIME_T_
  114. #ifdef macintosh
  115. #include <Time.h>
  116. #else
  117. typedef    _TIME_T_    time_t;
  118. #endif
  119. #undef    _TIME_T_
  120. #endif
  121.  
  122. #ifndef _POSIX_SOURCE
  123. #define    NBBY    8        /* number of bits in a byte */
  124.  
  125. /*
  126.  * Select uses bit masks of file descriptors in longs.  These macros
  127.  * manipulate such bit fields (the filesystem macros use chars).
  128.  * FD_SETSIZE may be defined by the user, but the default here should
  129.  * be enough for most uses.
  130.  */
  131. #ifndef    FD_SETSIZE
  132. #ifdef macintosh
  133. #define     FD_SETSIZE    64
  134. #else
  135. #define    FD_SETSIZE    256
  136. #endif
  137. #endif
  138.  
  139. typedef long    fd_mask;
  140. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  141.  
  142. #ifndef howmany
  143. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  144. #endif
  145.  
  146. typedef    struct fd_set {
  147.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  148. } fd_set;
  149.  
  150. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  151. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  152. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  153. #define    FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  154.  
  155. #if defined(__STDC__) && defined(KERNEL)
  156. /*
  157.  * Forward structure declarations for function prototypes.
  158.  * We include the common structures that cross subsystem boundaries here;
  159.  * others are mostly used in the same place that the structure is defined.
  160.  */
  161. struct    proc;
  162. struct    pgrp;
  163. struct    ucred;
  164. struct    rusage;
  165. struct    file;
  166. struct    buf;
  167. struct    tty;
  168. struct    uio;
  169. #endif
  170.  
  171. #endif /* !_POSIX_SOURCE */
  172. #endif /* !_TYPES_H_ */
  173.